package router

import (
	"github.com/gin-gonic/gin"
	"service_base_shop_api/user_web/api"
	"service_base_shop_api/user_web/middlewares"
)

//用户路由
func InitUserRouter(Router *gin.RouterGroup)  {
	UserRouter := Router.Group("user")
	{
		//UserRouter.GET("/index", func(ctx *gin.Context) {
		//	user ,err := global.UserSrvClient.GetOpenId(context.Background(),&protopb.GetOpenIdReq{Code: "22222"})
		//	fmt.Println(user,err)
		//	if err != nil {
		//		HandleGrpcErrorToHttp(err,ctx)
		//	}
		//	ctx.JSON(http.StatusOK,gin.H{"aa":user.Status})
		//})

		UserRouter.POST("/getsessionkey",api.GetSessionKey)
		UserRouter.POST("/authlogin",api.AuthLogin)
		UserRouter.POST("/addrlist",middlewares.JWTAuth(),api.AddrList)
		UserRouter.POST("/set_default",middlewares.JWTAuth(),api.SetDefault)
		UserRouter.POST("/del_addr",middlewares.JWTAuth(),api.DelAddr)
		UserRouter.POST("/get_province",middlewares.JWTAuth(),api.GetProvince)
		UserRouter.POST("/get_city",middlewares.JWTAuth(),api.GetCity)
		UserRouter.POST("/get_area",middlewares.JWTAuth(),api.GetArea)
		UserRouter.POST("/add_adds",middlewares.JWTAuth(),api.AddAdds)



		UserRouter.POST("/coll_goods",middlewares.JWTAuth(),api.CollGoods)
		UserRouter.POST("/get_voucher",middlewares.JWTAuth(),api.GetVoucher)


	}
}
